Skip to content

Conversation

@romtsn
Copy link
Member

@romtsn romtsn commented Oct 8, 2025

📜 Description

  • Sometimes we were using a recycled bitmap for masking (e.g. if recorder.close() is called from a different thread after we captured the screenshot, but before masking is applied) which resulted in native crashes when initing a Canvas backed by it. This PR checks for bitmap.isRecycled and recorder being closed before doing anything with the screenshot.
  • Added ReplayExecutorService which allows us to abstract away our "safe" way of submitting runnables, but also allows us to override this behaviour in tests in case we want a test to actual fail because of the exception thrown inside runnable.

💡 Motivation and Context

Closes getsentry/sentry-react-native#5159

💚 How did you test it?

Manually + automated

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

@romtsn romtsn requested a review from adinauer as a code owner October 8, 2025 14:22
cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 312.88 ms 363.88 ms 51.00 ms
Size 1.58 MiB 2.12 MiB 549.33 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
b3d8889 420.46 ms 453.71 ms 33.26 ms
ee747ae 386.94 ms 431.43 ms 44.49 ms
ee747ae 400.46 ms 423.61 ms 23.15 ms
9fbb112 361.43 ms 427.57 ms 66.14 ms
cf708bd 408.35 ms 458.98 ms 50.63 ms
ee747ae 396.82 ms 441.67 ms 44.86 ms
cf708bd 434.73 ms 502.96 ms 68.22 ms
bdbe1f4 380.66 ms 464.44 ms 83.78 ms
806307f 357.85 ms 424.64 ms 66.79 ms
f634d01 375.06 ms 420.04 ms 44.98 ms

App size

Revision Plain With Sentry Diff
b3d8889 1.58 MiB 2.10 MiB 535.07 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
9fbb112 1.58 MiB 2.11 MiB 539.18 KiB
cf708bd 1.58 MiB 2.11 MiB 539.71 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
cf708bd 1.58 MiB 2.11 MiB 539.71 KiB
bdbe1f4 1.58 MiB 2.11 MiB 538.88 KiB
806307f 1.58 MiB 2.10 MiB 533.42 KiB
f634d01 1.58 MiB 2.10 MiB 533.40 KiB

Previous results on branch: rz/fix/session-replay-bitmap-crash

Startup times

Revision Plain With Sentry Diff
18105ff 421.36 ms 469.44 ms 48.08 ms
c29cba5 317.66 ms 361.10 ms 43.44 ms

App size

Revision Plain With Sentry Diff
18105ff 1.58 MiB 2.11 MiB 540.43 KiB
c29cba5 1.58 MiB 2.12 MiB 549.34 KiB

Base automatically changed from markushi/canvas-approach to main October 20, 2025 12:20
@romtsn romtsn enabled auto-merge (squash) October 21, 2025 13:14
@romtsn romtsn merged commit 514df68 into main Oct 21, 2025
58 of 61 checks passed
@romtsn romtsn deleted the rz/fix/session-replay-bitmap-crash branch October 21, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android crash on io.sentry.android.replay.ScreenshotRecorder.capture

4 participants